home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- from rdflib import URIRef, BNode, Literal, RDF, Variable
- from rdflib.util import from_n3
- from rdflib.syntax.parsers import Parser
- from rdflib.syntax.parsers.n3p.n3proc import N3Processor
- from rdflib.Graph import Graph, QuotedGraph, ConjunctiveGraph
-
- class N3Parser(Parser):
-
- def __init__(self):
- pass
-
-
- def parse(self, source, graph):
- if not graph.store.context_aware:
- raise AssertionError
- if not graph.store.formula_aware:
- raise AssertionError
- conj_graph = ConjunctiveGraph(store = graph.store)
- conj_graph.default_context = graph
- sink = Sink(conj_graph)
- if not source.getPublicId() and source.getSystemId():
- pass
- baseURI = graph.absolutize('')
- p = N3Processor('nowhere', sink, baseURI = baseURI)
- p.userkeys = True
- p.data = source.getByteStream().read()
- p.parse()
- for prefix, namespace in p.bindings.items():
- conj_graph.bind(prefix, namespace)
-
-
-
-
- class Sink(object):
-
- def __init__(self, graph):
- self.graph = graph
-
-
- def start(self, root):
- pass
-
-
- def statement(self, s, p, o, f):
- f.add((s, p, o))
-
-
- def quantify(self, formula, var):
- pass
-
-
-